// 
// Bachelor of Software Engineering
// Media Design School
// Auckland
// New Zealand
//
// (c) 2005 - 2014 Media Design School
//
// File Name	: AlienWave.h
// Desrciption	: CAlienWave declaration file.
// Author		: Hayden Asplet.
// Mail			: hayden.asplet@mediadesignschool.com
//

#pragma once

#ifndef __ALIENWAVE_H__
#define __ALIENWAVE_H__

// Library Includes

// Local Includes

enum EWaveDirection {
	keRight,
	keLeft
};

class CAlienWave {
	// Member Functions
public:
	CAlienWave();
	~CAlienWave();

	void Update(float _fDeltaTime);	// Will move the wave if time interval is large enough.

	bool IsWaveCompleted() const;
	void CreateWave(int _iX, int _iY, int _iNumOfAliensX, int _iNumOfAliensY, int _iOffset, int _iIncrementY);
	void DestroyAlien(TGameObjectId _objectId);

	void Stop();
	void Continue();
	void ClearWave();

	// Accessors
	void SetRate(float _fRate);
	float GetRate() const;
	bool IsStopped() const;
	int GetBottom() const;	// The lowest Y value, used to see if the wave has hit the bottom of the screen.
protected:
private:
	// Disable copying.
	//CAlienWave(const CAlienWave& _wave);
	//CAlienWave& operator=(const CAlienWave& _wave);

	// Member Variables
public:
protected:
private:
	std::list<TGameObjectId> m_alienIds;	// The ids of the aliens in the wave.
	CRect m_waveBox;						// The rectangle defining the boundaries of the alien grid.
	EWaveDirection m_eDirection;			// The current direction of the wave.
	float m_fMoveInterval;					// The time since the last move.
	float m_fRate;							// The rate at which the wave moves.
	int m_iIncrementX;						// The amount to increment the wave position each move.
	int m_iIncrementY;						// The amount to increment the wave position downwards.

	float m_fFireBulletTimeBuffer;	// The accumulative time since the last bullet fire.
	float m_fFireBulletTime;		// The time to wait for the next fire.

	bool m_bIsStopped;	// True if the alien wave shouldn't update, false if it can update freely.
};

#endif